package com.vietnam.power.persitence;

import java.io.Serializable;

import javax.persistence.*;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;


/**
 * The persistent class for the message_type_dictionary database table.
 * 
 */
@Entity
@Table(name="message_type_dictionary")
public class MessageTypeDictionary implements Serializable {
	private static final long serialVersionUID = 1L;
	private int id;
	private Date createdDate;
	private String name;
	private List<MessageInfo> messageInfos;

	public MessageTypeDictionary() {
	}


	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}


	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="created_date")
	public Date getCreatedDate() {
		return this.createdDate;
	}

	public void setCreatedDate(Date createdDate) {
		this.createdDate = createdDate;
	}


	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}


	//bi-directional many-to-one association to MessageInfo
	@OneToMany(mappedBy="messageTypeDictionary")
	public List<MessageInfo> getMessageInfos() {
		if (this.messageInfos == null) {
			this.messageInfos = new ArrayList<MessageInfo>();
		}
		return this.messageInfos;
	}

	public void setMessageInfos(List<MessageInfo> messageInfos) {
		this.messageInfos = messageInfos;
	}

	public MessageInfo addMessageInfo(MessageInfo messageInfo) {
		getMessageInfos().add(messageInfo);
		messageInfo.setMessageTypeDictionary(this);

		return messageInfo;
	}

	public MessageInfo removeMessageInfo(MessageInfo messageInfo) {
		getMessageInfos().remove(messageInfo);
		messageInfo.setMessageTypeDictionary(null);

		return messageInfo;
	}

}